package org.example.registry;

import org.example.spi.SpiLoader;

/**
 * 注册中心工厂
 */
public class RegistryFactory {
    static {
        SpiLoader.load(Registry.class);
    }

    /**
     * 默认注册中心
     */
    private static final Registry DEFAULT_REGISTRY = new EtcdRegistry();

    /**
     * 获取实例
     * @param key
     * @return
     */
    public static Registry getInstance(String key){
        //key默认etcd
        System.out.println(Thread.currentThread().getName() + "执行RegistryFactory类中的getInstance(String key)方法"
                            + "参数为：" + key);
        return SpiLoader.getInstance(Registry.class,key);
    }
}
